package com.dc.service;

import com.dc.dao.ShipRepairDao;
import com.dc.dao.vo.ShipNameAndRepairIdVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class ShipRepairService {

    @Resource
    private ShipRepairDao shipRepairDao;

    public Map<Long, String> getShipNameRepairIdMap() {

        Map<Long, String> map = new HashMap<Long, String>();
        List<ShipNameAndRepairIdVO> shipNameAndRepairIdList = shipRepairDao.findShipNameAndRepairIdList();
        for(ShipNameAndRepairIdVO vo : shipNameAndRepairIdList) {
            map.put(vo.getShipRepairId(), vo.getShipName());
        }

        return map;
    }
}
